<template>
  <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="700px">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
      <el-form-item label="人员类型">
        <el-select v-model="form.personType" filterable placeholder="请选择">
          <el-option v-for="item in dict.dict.type_org_person" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue" />
        </el-select>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.personName" />
      </el-form-item>
      <el-form-item label="性别">
        <el-select v-model="form.personSex" filterable placeholder="请选择">
          <el-option v-for="item in dict.dict.type_common_sex" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue" />
        </el-select>
      </el-form-item>
      <el-form-item label="年龄">
        <el-input v-model="form.personAge" />
      </el-form-item>
      <el-form-item label="出生日期">
        <el-date-picker v-model="form.personBirthday" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" />
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="form.personPhone" />
      </el-form-item>
      <el-form-item label="身份证">
        <el-input v-model="form.personIdcard" />
      </el-form-item>
      <el-form-item label="身份证照片">
        <el-input v-model="form.personIdcardImgs" />
      </el-form-item>
      <el-form-item label="邮箱">
        <el-input v-model="form.personEmail" />
      </el-form-item>
      <el-form-item label="微信号">
        <el-input v-model="form.personWechat" />
      </el-form-item>
      <el-form-item label="个人简介">
        <el-input v-model="form.personIntroduction" :rows="3" type="textarea" />
      </el-form-item>
      <el-form-item label="个人照片">
        <el-input v-model="form.personImgs" />
      </el-form-item>
      <el-form-item label="政治面貌">
        <el-select v-model="form.personPolitical" filterable placeholder="请选择">
          <el-option v-for="item in dict.dict.type_common_political" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue" />
        </el-select>
      </el-form-item>
      <el-form-item label="人员标签">
        <tag-select v-model="form.personTags" :selects="form.personTags" tag-type="3" />
      </el-form-item>
      <el-form-item label="所在区域">
        <region-tree v-model="form.regionId" placeholder="请选择所在区域" :node-key="form.regionId" />
      </el-form-item>
      <el-form-item label="所在组织">
        <org-tree v-model="form.orgId" placeholder="请选择所在组织" :node-key="form.regionId" />
      </el-form-item>
      <el-form-item label="用户ID">
        <el-input v-model="form.userId" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="form.remark" :rows="3" type="textarea" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="crud.cancelCU">取消</el-button>
      <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { form } from '@crud/crud'
import OrgTree from '@/views/business/common/org/components/OrgTree/index'
import RegionTree from '@/views/business/common/org/components/RegionTree/index'
import TagSelect from '@/views/business/common/org/components/TagSelect/index'

const defaultForm = { personId: null, personType: null, personName: null, personSex: null, personAge: null, personBirthday: null, personPhone: null, personIdcard: null, personIdcardImgs: null, personEmail: null, personWechat: null, personIntroduction: null, personImgs: null, personPolitical: null, personTags: null, regionId: null, regionName: null, orgId: null, orgName: null, userId: null, remark: null }
export default {
  components: { TagSelect, RegionTree, OrgTree },
  mixins: [form(defaultForm)],
  props: {
    dict: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      rules: {
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
